





public class Main {

    public class ListNode {
        int val;
        ListNode next = null;
        public ListNode(int val) {
            this.val = val;
        }
    }
    public static void main(String[] args) {
        System.out.println(solve("0","0"));
    }

    //大数相乘
    public static String solve(String ss,String tt){
        int m = ss.length();
        int n = tt.length();
        char[] s = new StringBuffer(ss).reverse().toString().toCharArray();
        char[] t = new StringBuffer(tt).reverse().toString().toCharArray();
        int[] tmp = new int[m+n-1];
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++) {
                tmp[i+j] += (s[i]-'0')*(t[j]-'0');
            }
        }
        int cur = 0;
        int sum = 0;
        StringBuffer ret = new StringBuffer();
        while(cur<m+n-1 || sum!=0){
            if (cur<m+n-1) sum+=tmp[cur++];
            ret.append((char)(sum%10+'0'));
            sum/=10;
        }
        while (ret.length()>1 && ret.charAt(ret.length()-1)=='0'){
            ret.deleteCharAt((ret.length()-1));
        }
        return ret.reverse().toString();





    }


    //链表相加（二）
    public ListNode addInList (ListNode head1, ListNode head2){
        if (head1 == null) return head2;
        if (head2 == null) return head1;

        ListNode l1 = reverse(head1);
        ListNode l2 = reverse(head2);
        int carry = 0;
        ListNode head = new ListNode(-1);
        while (l1!=null || l2!=null || carry!=0){
            int num1 = (l1 == null) ? 0 : l1.val;
            int num2 = (l2 == null) ? 0 : l2.val;
            int sum = num1 +num2 +carry;
            ListNode next  =head.next;
            ListNode node = new ListNode(sum%10);
            carry = sum/10;
            head.next = node;
            node.next = next;
            if (l1!=null){
                l1 = l1.next;
            }
            if (l2 != null){
                l2 = l2.next;
            }
        }
        return head.next;
    }
    private ListNode reverse(ListNode head){
        ListNode pre = null;
        ListNode cur = head;
        while(cur!= null){
            ListNode next = cur.next;
            cur.next = pre;
            pre = cur;
            cur = next;
        }
        return pre;
    }

    //大数加法
    public String solve1 (String s, String t){
        int n1 = s.length();
        int n2 = t.length();
        if (s == null || s.equals("")) return t;
        if (t == null || t.equals("")) return s;

        int i = n1-1;
        int j = n2-1;
        int sNum = 0, tNum = 0;
        int carry = 0;
        int sum  =0;
        StringBuilder sb = new StringBuilder();
        while(i>=0 || j>=0){
            if (i>=0){
                sNum = s.charAt(i)-'0';
            }else{
                sNum = 0;
            }
            if (j>=0){
                tNum = t.charAt(j)-'0';
            }else{
                tNum = 0;
            }
            sum = sNum + tNum +carry;
            carry = sum/10;
            sb.append((char)(sum%10+'0'));
            i--;
            j--;
        }
        if (carry!=0) sb.append('1');
        sb.reverse();
        return sb.toString();
    }
}